package com.lanyou.esb.datadictionary;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 传输协议<br>
 * 描述：<br>
 * 1:http;2:https;
 * 
 * @author Davey.wu
 */
public enum TransportProtocolType {

	HTTP("1", "http"), HTTPS("2", "https");

	// public static final String TypeCode = "20009";

	public final String ValueCode;
	public final String ValueName;

	private TransportProtocolType(String code, String valueName) {
		this.ValueCode = code;
		this.ValueName = valueName;
	}

	public static TransportProtocolType get(String valueCode)
			throws NoSuchObjectException {
		if (StringUtils.isEmpty(valueCode)) {
			throw new NullPointerException();
		}
		for (TransportProtocolType type : TransportProtocolType.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
